/*
 * Alarms.h
 *
 *  Created on: Jan 21, 2014
 *      Author: ppks
 */

#ifndef ALARMS_H_
#define ALARMS_H_

/********************************************************************************/
/* Constants Definition                                                         */
/********************************************************************************/
enum alarm_resources {
    RESOURCE_LED,
    RESOURCE_BUZZER,
    RESOURCE_PL_GREEN,
    RESOURCE_PL_BLUE,
    RESOURCE_PL_RED,
    ALARM_RESOURCES_NUM         /* Indicate number of available resources in the system */
};

enum alarm_events {
    ALARM_EVENT_TOGGLE,
    ALARM_EVENT_FAILSAFE,
    ALARM_EVENT_NO_GPS,
    ALARM_EVENT_BEEPER_ON,
    ALARM_EVENT_POWER_METER,
    ALARM_EVENT_RUNTIME,
    ALARM_EVENT_V_BAT,
    ALARM_EVENT_CONFIRMATION,
    ALARM_EVENT_ACCELEROMETER,
    ALARM_EVENT_I2C_ERROR,
    ALARM_EVENTS_NUM            /* Indicates number of events in the system */
};

/* Define Alarm levels used in the firmware */
#define ALARM_LEVEL_NONE        0x00
#define ALARM_LEVEL_1           0x01
#define ALARM_LEVEL_2           0x02
#define ALARM_LEVEL_3           0x03
#define ALARM_LEVEL_4           0x04

/********************************************************************************/
/* Exported Variables Declaration                                               */
/********************************************************************************/
extern uint8_t Alarms_AlarmArray[];

/********************************************************************************/
/* Exported Functions Prototypes                                                */
/********************************************************************************/
extern void Alarms_Init(void);
extern void Alarms_ProcessHandler(void);
extern void Alarms_BlinkLED(uint8_t num, uint8_t ontime, uint8_t repeat);

/*******************************************************************************
* Function Name: Alarms_SetAlarmLevel
********************************************************************************
* Summary:
*   Sets Alarm Level for specified event
*
*******************************************************************************/
inline void Alarms_SetAlarmLevel(uint8_t event, uint8_t level)
{
    Alarms_AlarmArray[event] = level;
}

#endif /* ALARMS_H_ */
